package xyz.msj.hrm.doc;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * 针对Course课程表的文档映射
 * indexName索引库
 * type类型
 *课程的文档对象 3个作用: 1.创建索引库  2.创建文档映射 3.用它的存数据到ES中
 */
@Document(indexName = "hrm", type = "course")
@Data
public class CourseDocument {
    @Id
    @Field(type= FieldType.Long)
    private Long id;

    //综合查询的列
    @Field(type =FieldType.Text,analyzer = "ik_max_word",
            searchAnalyzer = "ik_max_word",store = false)
    private String searchField ;

    //课程标题,分词
    @Field(type =FieldType.Keyword)
    private String name;

    //价格
    @Field(type=FieldType.Float)
    private float price;

    //简介
    @Field(type =FieldType.Keyword)
    private String description;

    //课程类型
    @Field(type=FieldType.Long)
    private Long courseTypeId;

    //适用人群
    private String forUser;
    //课程等级
    @Field(type =FieldType.Keyword)
    private String gradeName;
    //课程等级
    private Long gradeId;
    //课程机构
    private Long tenantId;
    @Field(type =FieldType.Keyword)
    private String tenantName;
    //课程的节课时间
    private Date startTime;
    private Date endTime;
    //封面
    @Field(type =FieldType.Keyword)
    private String pic;
    private Integer viewCount;
    private Integer commentCount;
    private Integer saleCount;
    //收费规则：，收费0免费，1收费
    private Boolean charge;
    private Float priceOld;

    //上线时间
    private Date onLineTime;

}
